<%@page import="com.railway.system.model.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>

<html>
<head>
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/default/easyui.css">
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/icon.css">
			<link rel="stylesheet" type="text/css" href="${ctx}/css/default.css" />
	
		<link rel="stylesheet" href="${ctx}/css/ztree.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/zTreeStyle/zTreeStyle.css" type="text/css">
	
	<script type="text/javascript" src="${ctx}/scripts/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/xheditor-1.1.12-zh-cn.min.js"></script>		
	<script type="text/javascript" src="${ctx}/scripts/jquery.ztree.core-3.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.ztree.excheck-3.0.min.js"></script>

	<SCRIPT type="text/javascript">

 
      function getReturnValue(tempid,tempname) {    
                var a=new Array(tempid,tempname);
                window.returnValue = a;
                window.close();  

       }  
       
		var setting = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick,
				onCheck: onCheck
			}
		};


		function onClick(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}

		function onCheck(e, treeId, treeNode) {		
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
	
			    getReturnValue(nodes[i].id,nodes[i].name);
			    return;

			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#citySel");
			cityObj.attr("value", v);
		}

		function showMenu() {
			var cityObj = $("#citySel");
			var cityOffset = $("#citySel").offset();
			$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

			$("body").bind("mousedown", onBodyDown);
		}
		function hideMenu() {
			//$("#menuContent").fadeOut("fast");
			//$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
				hideMenu();
			}
		}

		$(document).ready(function(){		
		       $.get("${ctx}/system/SysDept/getDeptTree.do", {
                Action:"get",Name:"user01"}, function (data, textStatus){	
                var zNodes = eval(data);
		          $.fn.zTree.init($("#treeDemo"), setting, zNodes);
				});	
			
		});
		//-->
	</SCRIPT>
</head>
<body>

<div class="content_wrap">
	 <div class="zTreeDemoBackground left">
		<ul class="list">
			
			<input id="citySel" type="hidden" readonly value="" style="width:120px;" onclick="showMenu();" />
		
		</ul>
	</div>
	</div>
	<div id="menuContent" class="menuContent" style="display:true; position: absolute;">
		<ul id="treeDemo" class="ztree" style="margin-top:0; width:300px; height: 400px;"></ul>
    </div>
<script>

showMenu();
</script>

</body>

</html>

   	        
	     
	            
             